using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms.Design;

namespace BizTalk.BuildGenerator.MetaData
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks>
    /// <!--<WebServiceGenerator WebServiceDescriptionPath=".Ukm.Integration.CaseManagement.Web.Services.Description2.xml" />-->
    ///	<WseWebServiceGenerator WebServiceDescriptionPath="CaseManagement.Web.Services.Description.Wse.xml" />
    /// </remarks>
    [Serializable]
    public class PublishedWebService
    {
        private string _webServiceDescriptionPath;
        private WebServiceTypes _type;

        [Description("The type of web services which will be generated")]
        public WebServiceTypes Type
        {
            get { return _type; }
            set { _type = value; }
        }


        [Editor(typeof (FileNameEditor), typeof (UITypeEditor))]
        [Description("The path to the web service description file")]
        public string WebServiceDescriptionPath
        {
            get { return _webServiceDescriptionPath; }
            set { _webServiceDescriptionPath = value; }
        }
        /// <summary>
        /// Overrides tostring
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {            
            try
            {
                var comment = Enum.GetName(typeof(WebServiceTypes), _type);
                if (!string.IsNullOrEmpty(_webServiceDescriptionPath))
                    return comment + ": " + System.IO.Path.GetFileName(_webServiceDescriptionPath);
                return base.ToString();
            }
            catch
            {
                return base.ToString();
            }
        }
    }
}